﻿using System;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Web;
using IapApp;
using IapService.Entity;
using IapService.Service;

namespace IapService
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var response = LoginService.Login();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.ContentType = "text/plain";
            HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache");
            using (var mstream = new MemoryStream())
            {
                var json = new DataContractJsonSerializer(typeof(ServiceResponse<User>));
                json.WriteObject(mstream, response);
                HttpContext.Current.Response.BinaryWrite(mstream.ToArray());
            }
            HttpContext.Current.Response.End();
        }
    }
}